<?php

/**
 * Build link to location of resource's media
 */
class Zend_View_Helper_Videouri extends Zend_View_Helper_Abstract {

    public function Videouri($arrArticle = array()) {

        //return VIDEO_URL . '/' . $arrArticle['url'];

        $arrArticle['url'] = '/' . $arrArticle['url'];

        // Get security link
        //$videoLinkSecurity = Fpt_Movie::getSecurityPath(VIDEO_URL ,  $arrArticle['url'], $this->view->config['security']['download']['type_video'], $this->view->config['security']['download']['prefix_video'], $this->view->config['security']['download']['secretkey_video']);
        //return $videoLinkSecurity;

        // Expire 24h = 86400 second
        $currentTime = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
        //$currentTime = time();
        $strTimeInHex = sprintf("%08x", $currentTime);

        $strHash = md5($this->view->config['security']['download']['secretkey_video'] . $arrArticle['url'] . $strTimeInHex);
        return sprintf('%s%s%s/%s%s', VIDEO_URL, $this->view->config['security']['download']['prefix_video'], $strHash, $strTimeInHex, $arrArticle['url']);
    }

}